<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta name="Content-Type" content="text/html; charset=UTF-8" />
<title>Class: Sass::Importers::Base</title>
<link rel="stylesheet" href="style.css" tppabs="http://sass-lang.com/docs/yardoc/css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="common.css" tppabs="http://sass-lang.com/docs/yardoc/css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '../..';
  if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="jquery.js" tppabs="http://sass-lang.com/docs/yardoc/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js" tppabs="http://sass-lang.com/docs/yardoc/js/app.js"></script>

  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html" tppabs="http://sass-lang.com/docs/yardoc/_index.html">Index (B)</a> &raquo; 
    <span class='title'><a href="Sass-1.html" tppabs="http://sass-lang.com/docs/yardoc/Sass.html" title="Sass (module)">Sass</a></span> &raquo; <span class='title'><a href="Importers.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Importers.html" title="Sass::Importers (module)">Importers</a></span>
     &raquo; 
    <span class="title">Base</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="javascript:if(confirm(%27http://sass-lang.com/docs/yardoc/Sass/Importers/.  \n\nThis file was not retrieved by Teleport Pro, because the server reports that this file cannot be found.  \n\nDo you want to open it from the server?%27))window.location=%27http://sass-lang.com/docs/yardoc/Sass/Importers/.%27" tppabs="http://sass-lang.com/docs/yardoc/Sass/Importers/." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  <a id="class_list_link" href="#">Class List</a>
  <a id="method_list_link" href="#">Method List</a>
  <a id ="file_list_link" href="#">File List</a>
</div>

      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Sass::Importers::Base 
  <span class="abstract note title">Abstract</span>
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Sass::Importers::Base</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">/var/www/sass-pages/.sass/lib/sass/importers/base.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p class="note abstract">
  <strong>This class is abstract.</strong> 
  
</p>
<p>The abstract base class for Sass importers. All importers should inherit from this.</p>

<p>At the most basic level, an importer is given a string and must return a <tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt> containing some Sass code. This string can be interpreted however the importer wants; however, subclasses are encouraged to use the URI format for pathnames.</p>

<p>Importers that have some notion of &#8220;relative imports&#8221; should take a single load path in their constructor, and interpret paths as relative to that. They should also implement the <tt><a href="#find_relative-instance_method" title="Sass::Importers::Base#find_relative (method)">#find_relative</a></tt> method.</p>

<p>Importers should be serializable via <code>Marshal.dump</code>. In addition to the standard <code>_dump</code> and <code>_load</code> methods, importers can define <code>_before_dump</code>, <code>_after_dump</code>, <code>_around_dump</code>, and <code>_after_load</code> methods as per <tt>Sass::Util#dump</tt> and <tt>Sass::Util#load</tt>.</p>

  </div>
</div>
<div class="tags">
  
</div><div id="subclasses">
  <h2>Direct Known Subclasses</h2>
  <p class="children"><a href="Filesystem.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Importers/Filesystem.html" title="Sass::Importers::Filesystem (class)">Filesystem</a></p>
</div>



  <h2>Instance Method Summary</h2>

  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#find-instance_method" title="#find (instance method)">- (Sass::Engine<sup>?</sup>) <strong>find</strong>(uri, options) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Find a Sass file, if it exists.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#find_relative-instance_method" title="#find_relative (instance method)">- (Sass::Engine<sup>?</sup>) <strong>find_relative</strong>(uri, base, options) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Find a Sass file relative to another file.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#key-instance_method" title="#key (instance method)">- ((String, String)) <strong>key</strong>(uri, options) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Get the cache key pair for the given Sass URI.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#mtime-instance_method" title="#mtime (instance method)">- (Time<sup>?</sup>) <strong>mtime</strong>(uri, options) </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">Returns the time the given Sass file was last modified.</span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_s-instance_method" title="#to_s (instance method)">- (String) <strong>to_s</strong> </a>
    

    
  </span>
  
  
  
  
  

  
    <span class="summary_desc">A string representation of the importer.</span>
  
</li>

    
  </ul>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="find-instance_method">
  
    - (<tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt><sup>?</sup>) <strong>find</strong>(uri, options) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Find a Sass file, if it exists.</p>

<p>This is the primary entry point of the Importer. It corresponds directly to an <code>@import</code> statement in Sass. It should do three basic things:</p>

<ul>
<li>Determine if the URI is in this importer&#8217;s format. If not, return nil.</li>

<li>Determine if the file indicated by the URI actually exists and is readable. If not, return nil.</li>

<li>Read the file and place the contents in a <tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt>. Return that engine.</li>
</ul>

<p>If this importer&#8217;s format allows for file extensions, it should treat them the same way as the default <tt><a href="Filesystem.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Importers/Filesystem.html" title="Sass::Importers::Filesystem (class)">Filesystem</a></tt> importer. If the URI explicitly has a <code>.sass</code> or <code>.scss</code> filename, the importer should look for that exact file and import it as the syntax indicated. If it doesn&#8217;t exist, the importer should return nil.</p>

<p>If the URI doesn&#8217;t have either of these extensions, the importer should look for files with the extensions. If no such files exist, it should return nil.</p>

<p>The <tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt> to be returned should be passed <code>options</code>, with a few modifications. <code>:syntax</code> should be set appropriately, <code>:filename</code> should be set to <code>uri</code>, and <code>:importer</code> should be set to this importer.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <span class='name'>uri</span>
      
      
      
        &mdash;
        The URI to import.
      
    </li>
  
    <li>
      
        <span class='type'>(<tt>{Symbol =&gt; Object}</tt>)</span>
      
      
        <span class='name'>options</span>
      
      
      
        &mdash;
        Options for the Sass file containing the <code>@import</code> that&#8217;s currently being resolved. This is safe for subclasses to modify destructively. Callers should only pass in a value they don&#8217;t mind being destructively modified.
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt>, <tt>nil</tt>)</span>
      
      
      
      
        &mdash;
        An Engine containing the imported file, or nil if it couldn&#8217;t be found or was in the wrong format.
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/importers/base.rb', line 86</span>

def find(uri, options)
  Sass::Util.abstract(self)
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="find_relative-instance_method">
  
    - (<tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt><sup>?</sup>) <strong>find_relative</strong>(uri, base, options) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Find a Sass file relative to another file. Importers without a notion of &#8220;relative paths&#8221; should just return nil here.</p>

<p>If the importer does have a notion of &#8220;relative paths&#8221;, it should ignore its load path during this method.</p>

<p>See <tt><a href="#find-instance_method" title="Sass::Importers::Base#find (method)">#find</a></tt> for important information on how this method should behave.</p>

<p>The <code>:filename</code> option passed to the returned <tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt> should be of a format that could be passed to <tt><a href="#find-instance_method" title="Sass::Importers::Base#find (method)">#find</a></tt>.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <span class='name'>uri</span>
      
      
      
        &mdash;
        The URI to import. This is not necessarily relative, but this method should only return true if it is.
      
    </li>
  
    <li>
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <span class='name'>base</span>
      
      
      
        &mdash;
        The base filename. If <code>uri</code> is relative, it should be interpreted as relative to <code>base</code>. <code>base</code> is guaranteed to be in a format importable by this importer.
      
    </li>
  
    <li>
      
        <span class='type'>(<tt>{Symbol =&gt; Object}</tt>)</span>
      
      
        <span class='name'>options</span>
      
      
      
        &mdash;
        Options for the Sass file containing the <code>@import</code> that&#8217;s currently being resolved.
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt>, <tt>nil</tt>)</span>
      
      
      
      
        &mdash;
        An Engine containing the imported file, or nil if it couldn&#8217;t be found or was in the wrong format.
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


46
47
48</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/importers/base.rb', line 46</span>

def find_relative(uri, base, options)
  Sass::Util.abstract(self)
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="key-instance_method">
  
    - (<tt>(String, String)</tt>) <strong>key</strong>(uri, options) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Get the cache key pair for the given Sass URI. The URI need not be checked for validity.</p>

<p>The only strict requirement is that the returned pair of strings uniquely identify the file at the given URI. However, the first component generally corresponds roughly to the directory, and the second to the basename, of the URI.</p>

<p>Note that keys must be unique <em>across importers</em>. Thus it&#8217;s probably a good idea to include the importer name at the beginning of the first component.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <span class='name'>uri</span>
      
      
      
        &mdash;
        A URI known to be valid for this importer.
      
    </li>
  
    <li>
      
        <span class='type'>(<tt>{Symbol =&gt; Object}</tt>)</span>
      
      
        <span class='name'>options</span>
      
      
      
        &mdash;
        Options for the Sass file containing the <code>@import</code> currently being checked.
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>(String, String)</tt>)</span>
      
      
      
      
        &mdash;
        The key pair which uniquely identifies the file at the given URI.
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


121
122
123</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/importers/base.rb', line 121</span>

def key(uri, options)
  Sass::Util.abstract(self)
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="mtime-instance_method">
  
    - (<tt>Time</tt><sup>?</sup>) <strong>mtime</strong>(uri, options) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>Returns the time the given Sass file was last modified.</p>

<p>If the given file has been deleted or the time can&#8217;t be accessed for some other reason, this should return nil.</p>

  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <span class='name'>uri</span>
      
      
      
        &mdash;
        The URI of the file to check. Comes from a <code>:filename</code> option set on an engine returned by this importer.
      
    </li>
  
    <li>
      
        <span class='type'>(<tt>{Symbol =&gt; Objet}</tt>)</span>
      
      
        <span class='name'>options</span>
      
      
      
        &mdash;
        Options for the Sass file containing the <code>@import</code> currently being checked.
      
    </li>
  
</ul>
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>Time</tt>, <tt>nil</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


100
101
102</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/importers/base.rb', line 100</span>

def mtime(uri, options)
  Sass::Util.abstract(self)
end</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="to_s-instance_method">
  
    - (<tt>String</tt>) <strong>to_s</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>A string representation of the importer. Should be overridden by subclasses.</p>

<p>This is used to help debugging, and should usually just show the load path encapsulated by this importer.</p>

  </div>
</div>
<div class="tags">
  <h3>Returns:</h3>
<ul class="return">
  
    <li>
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


132
133
134</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File '/var/www/sass-pages/.sass/lib/sass/importers/base.rb', line 132</span>

def to_s
  Sass::Util.abstract(self)
end</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Fri Mar  8 20:34:04 2013 by 
  <a href="javascript:if(confirm(%27http://yardoc.org/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://yardoc.org/%27" tppabs="http://yardoc.org/" title="Yay! A Ruby Documentation Tool">yard</a>
  0.5.3 (ruby-1.8.7).
</div>


  <script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  </script>
  <script type="text/javascript">
  try {
  var pageTracker = _gat._getTracker("UA-535380-8");
  pageTracker._trackPageview();
  } catch(err) {}</script>


  </body>
</html>